home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / HTML Palette.as < prev    next >
Encoding:
Text File  |  1998-01-29  |  1.4 KB  |  38 lines  |  [TEXT/ToyS]

  1. property dNames : ["B", "I", "U", "Centre", "Font", "TD", "P", "HRef", ¬
  2.     "H1", "H2", "H3", "H4", "List", "Item", "Title", "Back Col"]
  3. property tPrefix : ["<B>", "<I>", "<U>", "<CENTER>", "<FONT SIZE=\"1\">", "<TD>", "<P>", "<A HREF=\"\">", ¬
  4.     "<H1>", "<H2>", "<H3>", "<H4>", "<UL>", "<LI>", "<TITLE>", "<BODY BGCOLOR=\""]
  5. property tSuffix : ["</B>", "</I>", "</U>", "</CENTER>", "</FONT>", "</TD>", "</P>", "</A>", ¬
  6.     "</H1>", "</H2>", "</H3>", "</H4>", "</UL>", "", "</TITLE>", "\">"]
  7. property dBounds : [60, 40, 262, 114]
  8. property gApp : application "ClarisWorks"
  9.  
  10. dd install with fonts {name:"Geneva", size:9} float above gApp
  11. tell gApp to activate
  12. try
  13.     dd make dialog {bounds:dBounds, default item:0, contents:[¬
  14.         b(1), b(2), b(3), b(4), b(5), b(6), b(7), b(8), ¬
  15.         b(9), b(10), b(11), b(12), b(13), b(14), b(15), b(16) ¬
  16.         ], style:sideways palette, name:"HTML", closeable:true}
  17.     repeat
  18.         set i to dd interact with user
  19.         if i = -1 then exit repeat
  20.         try
  21.             tell application "ClarisWorks"
  22.                 copy to clipboard
  23.                 set the clipboard to (tPrefix's item i) & (the clipboard) & (tSuffix's item i)
  24.                 paste
  25.             end tell
  26.         on error
  27.         end try
  28.     end repeat
  29.     set my dBounds to dd get bounds of dialog 1
  30. on error
  31. end try
  32. dd uninstall
  33.  
  34. on b(i)
  35.     set x to 2 + ((i - 1) mod 4) * 50
  36.     set y to 2 + ((i - 1) div 4) * 18
  37.     return {class:push button, bounds:[x, y, x + 48, y + 16], name:dNames's item i}
  38. end b